﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace eventr.View
{
    public partial class Navigation : UserControl
    {

        bool showRunning = false;
        
        public event EventHandler Previous;
        public event EventHandler Next;

        bool visible = false;

        public Navigation()
        {
            InitializeComponent();
            updateStates(false);
        }

        void updateStates(bool trans)
        {
            if (visible)
            {
                VisualStateManager.GoToState(this, "Visible", trans);
            }
            else
            {
                VisualStateManager.GoToState(this, "Invisible", trans);
            }
        }

        private void btnPrevious_Click(object sender, RoutedEventArgs e)
        {
            if (Previous != null)
            {
                Previous(this, EventArgs.Empty);
            }
        }        

        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            if (Next != null)
            {
                Next(this, EventArgs.Empty);
            }
        }

        private void Grid_MouseEnter(object sender, MouseEventArgs e)
        {
            visible = true;
            updateStates(true);
        }

        private void Grid_MouseLeave(object sender, MouseEventArgs e)
        {
            visible = false;
            updateStates(true);
        }
    }
}
